from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QProgressBar
from PyQt5.QtCore import Qt

class ProgressDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("处理进度")
        self.setWindowModality(Qt.WindowModal)
        self.setFixedSize(400, 120)
        
        layout = QVBoxLayout()
        self.label = QLabel("正在处理...")
        self.progress = QProgressBar()
        self.progress.setRange(0, 100)
        
        layout.addWidget(self.label)
        layout.addWidget(self.progress)
        self.setLayout(layout)
    
    def update_progress(self, value: int, text: str = None):
        self.progress.setValue(value)
        if text:
            self.label.setText(text)